package com.ebelter.temperature.activitys;



import android.content.Intent;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.RelativeLayout;
import com.ebelter.btcomlib.bases.activity.BaseActivity;
import com.ebelter.btcomlib.common.Constants;
import com.ebelter.btcomlib.utils.SpUtil;
import com.ebelter.btcomlib.utils.StatusBarUtil;
import com.ebelter.btcomlib.utils.UserSpUtil;
import com.ebelter.temperature.R;
import butterknife.BindView;

public class T_Welcome_Activity extends BaseActivity {


    @BindView(R.id.t_welcome_root_rl)
    RelativeLayout t_welcome_root_rl;

//    @BindView(R.id.t_welcome_root_ll)
//    LinearLayout t_welcome_root_ll;





    @Override
    protected int loadLayoutById() {
        return R.layout.activity_t_welcome;
    }

    @Override
    protected void initView() {
        setStatusBar();
        boolean firstInto= SpUtil.readBoolean(Constants.IUser.FIRST_INTO,true);

        long user_id = UserSpUtil.readLong(Constants.IUser.USER_ID,-1);
        String nick_name = UserSpUtil.readString(Constants.IUser.NICK_NAME);
        String btid = UserSpUtil.readString(Constants.IUser.BT_ID);




        if (user_id>0&&!TextUtils.isEmpty(nick_name)&&!TextUtils.isEmpty(btid)){
            //说明已经登录了 直接登录吧
            startActivity(T_MainActivity.class);
            finish();
            return;
        }
        if (!firstInto){
            startActivity(new Intent(this, T_LoginActivity.class));
            finish();
            return;
        }
       SpUtil.writeBoolean(Constants.IUser.FIRST_INTO,false);



    }



    @Override
    public boolean isSetTranslucent() {
        return false;
    }

    //设置状态栏
    protected void setStatusBar() {
        StatusBarUtil.setTranslucentForImageView(this,0, t_welcome_root_rl);

    }



    public void bt_join_splash(View view){
        startActivity(T_RegisterActivity.class);
    }
    public void bt_sign_splash(View view){
        startActivity(T_LoginActivity.class);
    }
}
